<template>
  <div>
    <!-- loading -->
    <loading :show="isLoading"></loading>
    <keep-alive>
      <router-view v-show="showcontent"></router-view>
    </keep-alive>
  </div>
</template>

<script type="text/ecmascript-6">
  import {mapGetters, mapMutations} from 'vuex';
  import Loading from '@/components/loading/loading.vue';

  export default {
    name: 'app',
    data() {
      return {};
    },
    components: {
      Loading
    },
    computed: {
      ...mapGetters([
        'isLoading'
      ]),
      showcontent() {
        return !this.isLoading;
      }
    },
    methods: {
      ...mapMutations([
        'SET_AUTHDATA'
      ])
    },
    created() {
      this.SET_AUTHDATA({openid: this.$route.query.openid, appid: this.$route.query.appid});
      this.$router.push({path: '/home'});
    }
  };
</script>
